// 方法
function Method(object) {
  var obj = object
  var self = this
  this.setCateScope = function() {
    var cateScop = []
    var categorys = obj.$refs.categoryTree.getCheckedNodes()
    if (categorys) {
      categorys.forEach(item => {
        if (item.level === 2) {
          cateScop.push(item.deptNbr + '/' + item.categoryNbr + ' ')
        }
      })
    }
    obj.phase.cateScope = cateScop.join('')
    // console.log('phase:' + JSON.stringify(obj.phase))
  }

  this.treeNodeCheck = function(data, nodeChecked, subNodeChecked) {
    self.setCateScope()
  }

  this.setCateScope2 = function(categorys) {
    var cateScop = []
    if (categorys) {
      categorys.forEach(dept => {
        if (dept.categorys) {
          dept.categorys.forEach(cate => {
            cateScop.push(dept.deptNbr + '/' + cate.categoryNbr + ' ')
          })
        }
      })
    }
    obj.phase.cateScope = cateScop.join('')
    // console.log('phase:' + JSON.stringify(obj.phase))
  }
}
export default Method
